﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace metricasdesoftware
{
    class conexion
    {
        public static SqlConnection Getconnection()
        {
            SqlConnection con = new SqlConnection();
            con.ConnectionString = @"server=.; database= metricas; user id= sa; password=amapola";
            return con;
        }

        public static DataTable usuarios()
        {
            SqlConnection con = Getconnection();
            SqlCommand comando = new SqlCommand();
            comando.Connection = con;
            comando.CommandType = CommandType.Text;
            comando.CommandText = "select nombre,apellidos,calle,colonia,numero,cp,curp from usuarios";
            using (con)
            {
                con.Open();
                SqlDataReader reader = comando.ExecuteReader();
                DataTable table = new DataTable();
                table.Load(reader);
                return table;
            }
        }
    }
}
